package com.nbsaas.boot.store.rest.convert;

import com.nbsaas.boot.store.data.entity.Store;
import com.nbsaas.boot.store.api.domain.simple.StoreSimple;

import com.nbsaas.boot.rest.api.Converter;

/**
* -列表对象转换器
*/

public class StoreSimpleConvert implements Converter<StoreSimple, Store> {




@Override
public StoreSimple convert(Store source) {
    StoreSimple result = new StoreSimple();

                result.setIncome(source.getIncome());
                result.setNote(source.getNote());

               try {
                   if(source.getShop()!=null){
                       result.setShop(source.getShop().getId());
                   }
                } catch (Exception ignored) { }

                result.setBoss(source.getBoss());
                result.setOpenId(source.getOpenId());
                result.setIcon(source.getIcon());

                try {
                    if(source.getShop()!=null){
                        result.setShopName(source.getShop().getName());
                    }
                } catch (Exception ignored) { }


                try {
                    if(source.getStoreCatalog()!=null){
                        result.setStoreCatalogName(source.getStoreCatalog().getName());
                    }
                } catch (Exception ignored) { }

                result.setBankName(source.getBankName());
                result.setPrivilege(source.getPrivilege());
                result.setChargeNo(source.getChargeNo());
                result.setBackMoney(source.getBackMoney());
                if(source.getStoreStatus()!=null){
                    result.setStoreStatusName(String.valueOf(source.getStoreStatus()));
                }
                result.setStoreStatus(source.getStoreStatus());
                result.setRate(source.getRate());

               try {
                   if(source.getStoreCatalog()!=null){
                       result.setStoreCatalog(source.getStoreCatalog().getId());
                   }
                } catch (Exception ignored) { }

                result.setBankNo(source.getBankNo());
                result.setLogo(source.getLogo());
                result.setId(source.getId());
                result.setLat(source.getLat());
                result.setLastDate(source.getLastDate());
                result.setBankAccount(source.getBankAccount());
                result.setSummary(source.getSummary());
                result.setCharge(source.getCharge());
                result.setAddress(source.getAddress());
                result.setLng(source.getLng());
                result.setRebate(source.getRebate());
                result.setZoom(source.getZoom());
                result.setAddDate(source.getAddDate());
                result.setMoney(source.getMoney());
                result.setPhone(source.getPhone());
                result.setName(source.getName());

               try {
                   if(source.getAccount()!=null){
                       result.setAccount(source.getAccount().getId());
                   }
                } catch (Exception ignored) { }


                try {
                    if(source.getAccount()!=null){
                        result.setAccountAmount(source.getAccount().getAmount());
                    }
                } catch (Exception ignored) { }



    return result;
}

}